yes what he did was legal but if a cop ever tries searching your car, never let them unless they have probable cause (i.e. drugs or alcohol in plain view). tell them politely that they need a search warrent and make sure you get their badge number. it's illegal when they search your car without probable cause and without your permission. anything they find then (even if it's a kilo of coke in your trunk) you cannot be charged for. but if you let a cop intimidate you into searching your car, whatever he finds, you can be charged for. they know it's illegal, they just don't figure that you know it is too. if he tries to get pushy, ask for his badge number. he'll back off if he sees that you know your rights.